public class Main {
    public listdemo1.ListNode mergeTowLists(listdemo1.ListNode headA,listdemo1.ListNode headB){
//        实例化一个静态内部类对象
        listdemo1.ListNode newHead = new listdemo1.ListNode(-1);
        listdemo1.ListNode tmp = newHead;
//        保证两个链表都不为空
        while (headA.next != null & headB != null){
            if (headA.val < headB.val){
                tmp.next = headA;
                headA = headA.next;
                tmp = tmp.next;
            }else {
                tmp.next = headB;
                headB = headB.next;
                tmp = tmp.next;
            }
        }

        if(headA != null){
            tmp.next = headA;
        }else {
            tmp.next = headB;
        }
        return newHead.next;
    }
}